package com.example.Administrator.shoujiweishi.fragments.base;

import android.app.Fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import butterknife.Unbinder;

/**
 * Created by Administrator on 2017/5/27 0027.
 */

public abstract class BaseFragment extends Fragment{
    private View view;
    Unbinder unbinder;
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
        if (view==null) {
            view = inflater.inflate(getContentXML(), container,false);
        }
        initView();
        initData();
        return view;
    }
    //得到布局文件  根据子类来决定
    public abstract int getContentXML();
    public abstract void initData();
    public abstract  void initView();
    @Override
    public void onDestroyView() {
        super.onDestroyView();
        if (unbinder!=null){
            unbinder.unbind();
        }
    }
    public View getthisview(){
        return view;
    }
}
